<?php namespace App\Model;

//use Illuminate\Database\Eloquent\Model;

use App\Lib\Params\BaseWebParams;

class InfoExtField extends BaseModel {

    //
    public static function getExtFields()
    {
        $extFields = self::select(array('id','field_name','field_desc'))
            ->where('business_id' , '=', BaseWebParams::getBusinessId())
            ->where('status' , '=', '0')->get();
        foreach($extFields as $key=>$extField){
            $extFields[$key]['field_option'] = json_decode($extField->field_desc);
        }
        return $extFields;
    }
    //
    public static function getExtFieldsData()
    {
        $extFieldsData = array();
        $extFields = self::select(array('id','field_name'))
            ->where('business_id' , '=', BaseWebParams::getBusinessId())
            ->where('status' , '=', '0')->get();
        foreach($extFields as $extField){
            $extFieldsData[$extField['field_name']] = $extField['id'];
        }
        return $extFieldsData;
    }
}
